<?php namespace Home\Controller; 

use Hdphp\Controller\Controller;

//测试控制器
class IndexController extends Controller{

	//构造函数
	public function __init(){
		
		
	}
	
//  首页展示
    public function index(){
    	
//		Data::channelLevel($data, $pid = 0, $html = "&nbsp;", $fieldPri = 'cid', $fieldPid = 'pid', $level = 1);
	$cateDate=Db::table('cate')->get();
//	p($date);die;
	$cateData=Data::channelLevel($cateDate);
//	p($cateData);die;
//	foreach($cateData as $k=>$v){
////		p($v['cname']);die;
//		foreach($v['_data'] as $kk=>$vv){
//			
////			p($vv['cname']);die;
//		}
//		
//		
//	}
//	明星
	$dataMx=Db::table('goods')->limit(6)->get();
//	p($dataSj);die;
	
	View::with('dataMx',$dataMx);
//	猜你喜欢
	$dataSj=Db::table('goods')->orderBy('rand()')->limit(6)->get();
	
	View::with('dataSj',$dataSj);
	
	
//	p($cateData['cname']);die;
	View::with('cateData',$cateData);
		
//	联想电脑	
	$dataLx=Db::table('goods')->join('cate','cate_cid','=','cid')->where('pid',2)->get();
//		p($dataLx);die;
	View::with('dataLx',$dataLx);	
//	Think	
	$dataTh=Db::table('goods')->join('cate','cate_cid','=','cid')->where('pid',11)->limit(8)->get();
//		p($dataLx);die;
	View::with('dataTh',$dataTh);		
		
//	手机
	$dataSjj=Db::table('goods')->join('cate','cate_cid','=','cid')->where('pid',44)->limit(8)->get();
	
	View::with('dataSjj',$dataSjj);
	
	
	
	
	
	
	
		
       View::make();
    }
	
	
	
	
	
	
	
}
